from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By

diver=webdriver.Edge()
diver.maximize_window()
diver.get('file:///C:/Users/HP/Desktop/%E5%BC%B9%E7%AA%97/confirm.html')

diver.find_element(By.ID,'button').click()
sleep(5)

confirm=diver.switch_to.alert
confirm.dismiss()
sleep(5)